package com.xmeta.opensdk.controller;

import com.xmeta.opensdk.model.dto.CommonReq;
import com.xmeta.opensdk.model.vo.CommonResp;
import com.xmeta.opensdk.service.InvokingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/xmeta/mall")
@Slf4j
public class XMetaController {

    @Resource
    private InvokingService invokingService;

    /**
     * 一级平台向Xmeta上传商品档案
     */
    @PostMapping("/archive/transfer")
    public void archiveTransfer(){
        invokingService.archiveTransfer();
    }

    /**
     * XMeta向一级平台发起买家接收地址校验
     * @param commonReq
     * @return
     */
    @PostMapping("/receive/verify")
    public CommonResp receiveVerify(@RequestBody CommonReq commonReq){
        return invokingService.receiveVerify(commonReq);
    }

    /**
     * XMeta向一级平台发起上架下架藏品
     * @param commonReq
     * @return
     */
    @PostMapping("/goods/putAway")
    public CommonResp goodsPutAway(@RequestBody CommonReq commonReq){
        return invokingService.goodsPutAway(commonReq);
    }

    /**
     * Xmeta向一级平台转赠结果查询
     * @param commonReq
     * @return
     */
    @PostMapping("/goods/transferConfirm")
    public CommonResp goodsTransferConfirm(@RequestBody CommonReq commonReq){
        return invokingService.goodsTransferConfirm(commonReq);
    }

    /**
     * Xmeta向一级平台发起转赠操作
     * @param commonReq
     * @return
     */
    @PostMapping("/goods/transfer")
    public CommonResp goodsTransfer(@RequestBody CommonReq commonReq){
        return invokingService.goodsTransfer(commonReq);
    }


    /**
     * Xmeta向一级平台验证用户藏品
     * @param commonReq
     * @return
     */
    @PostMapping("/goods/verify")
    public CommonResp goodsVerify(@RequestBody CommonReq commonReq){
        return invokingService.goodsVerify(commonReq);
    }


    /**
     *
     * Xmeta向一级平台获取用户未锁定藏品信息列表
     *
     * @param commonReq
     * @return
     */
    @PostMapping("/goods/list")
    public CommonResp goodsList(@RequestBody CommonReq commonReq){
        return invokingService.goodsList(commonReq);
    }


    /**
     * Xmeta向一级平台验证用户信息
     *
     * @param commonReq
     * @return
     */
    @PostMapping("/user/verify")
    public CommonResp user(@RequestBody CommonReq commonReq) {
        return invokingService.syncUser(commonReq);
    }

}
